package com.practice.Http.XML.Coder.Response;

import com.practice.Http.XML.Coder.AbstractHttpXmlDecoder;
import com.practice.Http.XML.Coder.POJO.HttpXmlResponse;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpResponse;

import java.util.List;

/**
 * Created by Crowhyc on 2015/3/2.
 */
public class HttpXmlResponseDecoder extends AbstractHttpXmlDecoder<DefaultFullHttpResponse> {
    public HttpXmlResponseDecoder(Class clazz) {
        this(clazz,
                false);
    }

    public HttpXmlResponseDecoder(Class clazz, boolean isPrint) {
        super(clazz,
                isPrint);
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, DefaultFullHttpResponse msg, List<Object> out) throws Exception {
        HttpXmlResponse response = new HttpXmlResponse(
                msg,
                decode0(ctx,
                        msg.content()));
        out.add(response);
    }
}
